/*
 * @lc app=leetcode.cn id=2220 lang=typescript
 *
 * [2220] 转换数字的最少位翻转次数
 */

// @lc code=start
function minBitFlips(start: number, goal: number): number {
    return (start ^ goal)
        .toString(2)
        .split("")
        .reduce((a, b) => {
            if (b === "1") return a + 1;
            return a;
        }, 0);
}
// @lc code=end
